﻿<div ng-controller="loginCtrl">
    <div class="register-container animated fadeInDown">
        <div class="registerbox1 bg-white">
            <div class="registerbox-title">注册</div>
            <hr class="wide" />
            <!-- $dirty:表单有填写记录, $valid:字段内容合法的,$invalid:字段内容是非法的, $pristine:表单没有填写记录-->
            <!-- <div class="registerbox-caption ">Please fill in your information</div> -->
            <form name="registerForm" novalidate>
                <div class="registerbox-textbox">
                    <p class="error colorRed" ng-if="registerForm.rename.$error.required && registerForm.rename.$touched">用户名不能为空</p>
                    <input type="text" class="form-control" id="rename" name="rename" placeholder="请输入用户名" ng-model="registerData.name" required/>
                </div>
                <div class="registerbox-textbox">
                    <p class="error colorRed" ng-if="registerForm.password.$error.required && registerForm.password.$touched">请输入密码</p>
                    <p class="colorRed">
                        <span ng-show="registerForm.password.$invalid">
                            <span ng-show="registerForm.password.$error.minlength">密码长度不小于6</span>
                            <span ng-show="registerForm.password.$error.maxlength">密码长度不超过20</span>
                        </span>
                    </p>
                    <input type="password" class="form-control" id="password" name="password" ng-minlength="6" ng-maxlength="20" placeholder="请输入密码（6-20位）" ng-model="registerData.password" required/>
                </div>
                <div class="registerbox-textbox">
                    <p class="error colorRed" ng-if="registerForm.passwordagain.$error.required && registerForm.passwordagain.$touched">请再次输入密码</p>
                    <p class="colorRed" ng-if="registerForm.passwordagain.$dirty && registerData.passwordagain!=registerData.password">两次密码输入不一致</p>
                    <input type="password" class="form-control" id="passwordagain" name="passwordagain" ng-minlength="6"
                    ng-maxlength="20" compare="registerData.password" placeholder="请确认密码" ng-model="registerData.passwordagain" required/>
                </div>
                <div class="registerbox-textbox">
                    <span>权限认证：</span>
                    <select ng-model="registerData.authority">
                        <option value="0">普通用户</option>
                        <option value="1">管理员</option>
                    </select>
                </div>

                <div class="registerbox-submit">
                    <input type="button" class="btn btn-primary pull-right" value="提交" ng-disabled="!(registerForm.rename.$dirty&&registerForm.rename.$valid&&registerForm.password.$dirty&&registerForm.password.$valid&&registerForm.passwordagain.$dirty&&registerForm.passwordagain.$valid)" ng-click="userRegister()">
                </div>
            </form>
            
        </div>
    </div>
</div>